package com.skywolf.chem.live.controller;


import com.skywolf.chem.common.sysconfig.pojo.dto.PageDTO;
import com.skywolf.chem.common.sysconfig.pojo.vo.PageVO;
import com.skywolf.chem.common.sysconfig.response.RespData;
import com.skywolf.chem.live.param.VideoDto;
import com.skywolf.chem.live.param.VideoInfoDto;
import com.skywolf.chem.live.service.ILiveService;
import com.skywolf.chem.live.service.IVideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 视频信息表 前端控制器
 * </p>
 *
 * @author 
 * @since 2020-11-30
 */
@RestController
@RequestMapping("/edu/video")
@Api(value = "API-视频相关接口", description = "API-视频相关接口")
public class VideoController {

    @Autowired
    IVideoService videoService;

    @ApiOperation(value = "首页-视频列表",notes = "首页-视频列表")
    @RequestMapping(value = "/videoList",method = {RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespData<PageVO<VideoDto>> videoList(HttpServletRequest request, @RequestBody @Validated PageDTO queryParam) {
        PageVO<VideoDto> page = videoService.pageVideoList(queryParam);
        return RespData.success(page);
    }


    @ApiOperation(value = "视频列表-视频详情",notes = "视频列表-视频详情")
    @RequestMapping(value = "/videoInfo",method = {RequestMethod.GET},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespData<VideoInfoDto> videoInfo(HttpServletRequest request, @RequestParam(value = "videoId",required = true) Long videoId) {
        VideoInfoDto info = videoService.getVideoInfo(videoId);
        return RespData.success(info);
    }

}
